package cate.game.event.eliterace;

import cate.game.event.GameEventListener;
import cate.game.pvp.eliterace.handler.EliteRaceHandler;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class EliteRaceTimerEventListener implements GameEventListener<EliteRaceTimerEvent> {

    @Override
    public void onEvent(EliteRaceTimerEvent timerEvent) {
        log.debug("收到了事件 {}", timerEvent);
        EliteRaceHandler handler = timerEvent.getGameBody().pvp.eliteRace.getHandler();
        switch (timerEvent.getEventType()) {
            case OPEN:
                handler.onOpenEvent(timerEvent.getOpenEvent());
                break;
            case CLOSE:
                handler.onCloseEvent(timerEvent.getClosedEvent());
                break;
            case RANK_SETTLE:
                handler.onRankSettleEvent(timerEvent.getRankSettleEvent());
                break;
            case INVITATION:
                handler.onInvitationEvent(timerEvent.getInvitationEvent());
                break;
            case TRIAL:
                handler.onTrialEvent(timerEvent.getTrialEvent());
                break;
            case KO:
                handler.onKoEvent(timerEvent.getKoEvent());
                break;
            case FINAL:
                handler.onFinalEvent(timerEvent.getFinalEvent());
                break;
            case RANK_SWITCH:
                handler.onRankSwitchEvent(timerEvent.getRankSwitchEvent());
                break;
            case SHOW:
                handler.onShowEvent(timerEvent.getShowEvent());
                break;
            case REST:
                handler.onRestEvent(timerEvent.getRestEvent());
                break;
            default:
                break;
        }
    }
}
